
import java.util.*;
import java.io.*;

// OR63 删除公共字符
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s = reader.readLine();
        String t = reader.readLine();
        HashSet<Character> set = new HashSet<>();
        for(char c : t.toCharArray()){
            set.add(c);
        }
        StringBuffer res = new StringBuffer();
        for(char c:s.toCharArray()){
            if(!set.contains(c)){
                res.append(c);
            }
        }
        System.out.print(res.toString());

    }
}




//JZ52 两个链表的第一个公共结点


class ListNode {
    int val;
    ListNode next = null;

    ListNode(int val) {
        this.val = val;
    }
}
 class Solution {
    public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {
        ListNode cur = pHead1;
        int len1=0;
        int len2=0;

        while(cur!=null){
            len1++;
            cur=cur.next;
        }

        cur=pHead2;
        while(cur!=null){
            len2++;
            cur=cur.next;
        }

        int len=len1-len2;
        if(len<0){
            while(len!=0){
                pHead2=pHead2.next;
                len++;
            }
        }else{
            while(len!=0){
                pHead1=pHead1.next;
                len--;
            }
        }
        while(pHead1!=null&&pHead2!=null){
            if(pHead1==pHead2){
                return pHead1;
            }
            pHead1=pHead1.next;
            pHead2=pHead2.next;
        }
        return null;
    }
}



//mari和shiny
//记录每个y之前有多少个sh的同时，也要记录每个h之前有多少个s
 class Main1{
    public static void main(String[] args) throws IOException{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(reader.readLine());
        String s = reader.readLine();

        long slen=0;
        long ylen=0;
        long hlen=0;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='s'){
                slen++;
            }else if(s.charAt(i)=='h'){
                hlen+=slen;
            }else if(s.charAt(i)=='y'){
                ylen+=hlen;
            }
        }
        System.out.println(ylen);
    }
}
